package com.mymoney.wink;

import java.util.HashSet;
import java.util.Set;

import javax.ws.rs.core.Application;

import org.codehaus.jackson.jaxrs.JacksonJsonProvider;
import org.codehaus.jackson.map.ObjectMapper;

import com.mymoney.jackson.JacksonContext;

public class RestApplication extends Application {

	/**
	 * Get the list of service classes provided by this JAX-RS application
	 */
	@Override
	public Set<Class<?>> getClasses()
	{
		Set<Class<?>> serviceClasses = new HashSet<Class<?>>();

		serviceClasses.add(com.mymoney.resources.StoreResource.class);
		serviceClasses.add(com.mymoney.resources.CategoryResource.class);
		serviceClasses.add(com.mymoney.resources.CurrencyResource.class);
		serviceClasses.add(com.mymoney.resources.DeviceResource.class);
		serviceClasses.add(com.mymoney.resources.ItemResource.class);
		serviceClasses.add(com.mymoney.resources.PlatformResource.class);
		return serviceClasses;
	}

	@Override
	public Set<Object> getSingletons()
	{
		Set<Object> s = new HashSet<Object>();

		ObjectMapper mapper = JacksonContext.getObjectMapperInstance();
		JacksonJsonProvider jsonProvider = new JacksonJsonProvider();
		jsonProvider.setMapper(mapper);

		s.add(jsonProvider);
		return s;
	}
	
}
